<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%--
  Created by IntelliJ IDEA.
  User: skyADMIN
  Date: 15/9/2
  Time: 上午9:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    int flag = 0;
    int uid = Integer.parseInt(String.valueOf(session.getAttribute("uid")));
    request.setCharacterEncoding("utf-8");
    String old_psw = request.getParameter("old_psw")==null?"":new String(request.getParameter("old_psw").getBytes("ISO8859_1"),"UTF-8");
    String new_psw = request.getParameter("new_psw")==null?"":new String(request.getParameter("new_psw").getBytes("ISO8859_1"),"UTF-8");
    databaseUtil db = new databaseUtil();
    String sql = "select * from student_login where uid="+uid+" and password='"+old_psw+"'";
    //System.out.print(sql);
    ResultSet rs = db.executeQuery(sql);
    if (rs.next()){
        //System.out.print(123);
        flag = 1;
    }else {
        flag = 0;
        out.print("false");
    }

    if (flag==1){
        sql = "update student_login set password='"+new_psw+"' where uid="+uid;
        db.executeUpdate(sql);
        out.print("true");
    }
%>
<html>
<head>
    <title></title>
</head>
<body>

</body>
</html>
